# 练习12.1和12.2
import pygame
import sys
from picture import Picture

class Blue_air:
    """初始化"""
    def __init__(self):
        pygame.init()
        self.screen = pygame.display.set_mode((2000, 1000))
        pygame.display.set_caption("Blue air")
        self.clock = pygame.time.Clock()
        self.picture = Picture(self)

        # 设置背景色
        self.bg_color = (0, 0, 255)

    def run_game(self):
        """开始游戏主循环"""
        while True:
            # 侦听键盘和鼠标事件
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    sys.exit()

           # 每次循环时都重绘屏幕
            self.screen.fill(self.bg_color)
            self.picture.blitme()

           # 让最近绘制的屏幕可见
            pygame.display.flip()
            self.clock.tick(60)

if __name__ == '__main__':
    # 创造游戏实例并运行游戏
    ai = Blue_air()
    ai.run_game()





